Skip to content

#37: Add current OS#44

Closed
xenia-lang wants to merge 1 commit intoTNG:mainfrom
xenia-lang:issue-37
Closed

#37: Add current OS#44
xenia-lang wants to merge 1 commit intoTNG:mainfrom
xenia-lang:issue-37

Conversation

@xenia-lang
Copy link
Copy Markdown

No description provided.

Signed-off-by: Xenia Lang <xenia.lang@tngtech.com>
Comment thread please.sh
get_command() {
role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer.
os=get_os
role="You translate the given input into a bash command for $os. You may not use natural language, but only a bash command as an answer.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest not to use bash as we do not know whether the user is actually using bash or another shell (such as zsh, fish, ...). I would suggest to either use the more generic shell (maybe even request the command to be POSIX compliant).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively one may retrieve information about the shell in use, e.g. from the SHELL env variable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiderich @xenia-lang I'd like to get this PR merged—the idea seems useful to me.
What do you think about getting the current shell name as well as the OS to cover all cases?

e.g. using

get_shell()
  if [ -n "$SHELL" ]; then
    current_shell="$(basename "$SHELL")"
  else
    current_shell=""

and the adapting the prompt to:

  role="You translate the given input into a shell command for $os. The user is running $current_shell. You may not use natural language, but only the command as an answer."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

Copy link
Copy Markdown
Collaborator

@JonathanRohland-TNG JonathanRohland-TNG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure that we address the open comments before merging.

Comment thread please.sh
get_command() {
role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer.
os=get_os
role="You translate the given input into a bash command for $os. You may not use natural language, but only a bash command as an answer.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiderich @xenia-lang I'd like to get this PR merged—the idea seems useful to me.
What do you think about getting the current shell name as well as the OS to cover all cases?

e.g. using

get_shell()
  if [ -n "$SHELL" ]; then
    current_shell="$(basename "$SHELL")"
  else
    current_shell=""

and the adapting the prompt to:

  role="You translate the given input into a shell command for $os. The user is running $current_shell. You may not use natural language, but only the command as an answer."

Comment thread please.sh

get_command() {
role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer.
os=get_os
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the assignment to os in os=get_os have any effect at all?
If I read the definition of get_os correctly, then it doesn't actually return any value, but directly assign the OS name to the os variable.

To return something, shouldn't it be:

get_os() {
  unameOut=$(uname -s)
  case "$unameOut" in
    Darwin)
      echo "MacOS"
      ;;
    Linux)
      echo "Linux"
      ;;
    *)
      echo "Linux"
      ;;
  esac
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then the function call would be os=$(get_os)

@JonathanRohland-TNG
Copy link
Copy Markdown
Collaborator

bugbot run

@cursor
Copy link
Copy Markdown

cursor bot commented Jun 8, 2025

🚨 BugBot failed to run

Remote branch not found for this Pull Request. It may have been merged or deleted (requestId: serverGenReqId_f1413ae6-f32f-4dc9-8c2e-5153e6d856f3).

@JonathanRohland-TNG
Copy link
Copy Markdown
Collaborator

Closing this in favor of #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants